/**************子弹类**************/
function Bullet(type, x, y, speed) {
	this.node = document.createElement('img');
	this.type = type;
	this.x = x;
	this.y = y;
	this.height;
	this.width;
	this.speed = speed;

	this.init();
}

Bullet.prototype.init = function() {
	this.node.src = 'img/'+bulletArr[`${this.type}`].src;
	
	this.node.style.position = 'absolute';
	this.node.style.left = this.x + 'px';
	this.node.style.top = this.y + 'px';
	this.node.style.width = bulletArr[`${this.type}`].width + 'px';
	this.node.style.height = bulletArr[`${this.type}`].height + 'px';
	canvas.appendChild(this.node);
};

Bullet.prototype.move = function() {
	// 超出画布删除子弹
	if (this.y +this.node.offsetHeight< 0) {
		canvas.removeChild(this.node);
		return true;
	}
	
	this.y -= this.speed;
	this.node.style.top = this.y + 'px';
};
/**************子弹类**************/
